<template>
	<view>
		<view style="width: 100%;height: 550upx;">
			<image style="width: 550upx;height: 100%;margin: 520upx 100upx 0;" :src="qrimg" @click="pImage(qrimg,1)" mode=""></image>
			<view style="text-align: center;color: #fff;font-size: 24upx;margin-top: 20upx;">
				点击识别二维码加客服微信
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				qrimg: '',
				openid:'',
			}
		},
		onLoad:function(){
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../../login/login'
					});
				}
			});
		},
		methods: {
			setAjax(){
				uni.request({
					url: 'http://m.wpweipin.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.kf&app=1',
					method: 'POST',
					data: {'openid':this.openid},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						this.qrimg = res.data.kf_url
					},
					fail: () => {},
					complete: () => {}
				});
			},
			pImage (img,index) {
				console.log(img,index)
				uni.previewImage({
					current: index,
					urls: [img],
					longPressActions: {
						success: function(data) {},
						fail: function(err) {}
					},
				})
			},
		}
	}
</script>

<style>
page {background-color: #fff;background: url(../../static/51.jpg) no-repeat;background-position: left top;background-size: 100%;}
</style>
